//
//  DataManager.m
//  mhome
//
//  Created by YaSha_Tom on 2018/12/5.
//  Copyright © 2018年 刘春雷. All rights reserved.
//

#import "DataManager.h"
#import <MJExtension.h>
#import "orderModel.h"
#import "ProjectListModel.h"
#import "ProjectInfoModel.h"
#import "ProjectPeopleModel.h"
#import "PersonModel.h"

@implementation DataManager

static DataManager *_datamanager = nil;
+ (DataManager *)sharedDataManager {
    
    if (!_datamanager) {
        
        _datamanager = [[DataManager alloc] init];
    }
    
    return _datamanager;
}
+ (NSArray *)getOrderListData:(id)responseObject {
    NSArray *orderArray = responseObject[@"data"];
    NSMutableArray *mutableArray = [NSMutableArray array];
    for (NSDictionary *dic in orderArray) {
        //字典转model的第三方MJExtension
        orderModel *model = [orderModel mj_objectWithKeyValues:dic];
        [mutableArray addObject:model];
    }
    return [mutableArray copy];
}

+ (NSArray *)getPMSInfoListData:(id)response {
    NSMutableArray *mutableArray = [NSMutableArray array];
    if (![response[@"data"] isEqual:[NSNull null]]) {
        for (NSDictionary *dic in response[@"data"]) {
            ProjectListModel *model = [ProjectListModel mj_objectWithKeyValues:dic];
            [mutableArray addObject:model];
        }
    }
    return [mutableArray copy];
}
+ (NSArray *)getPMSInfoData:(id)response {
    NSDictionary *infoDic = response[@"data"];
    NSLog(@"=====%@",infoDic);
    NSMutableArray *mutableArray = [NSMutableArray array];
        //字典转model的第三方MJExtension
    ProjectInfoModel *model = [ProjectInfoModel mj_objectWithKeyValues:infoDic];
    NSLog(@"---%@",model);
    [mutableArray addObject:model];
    return [mutableArray copy];
}
+(NSArray *)getPMSPeopleData:(id)response {
    NSArray *orderArray = response[@"data"];
    NSMutableArray *mutableArray = [NSMutableArray array];
    for (NSDictionary *dic in orderArray) {
        //字典转model的第三方MJExtension
        ProjectPeopleModel *model = [ProjectPeopleModel mj_objectWithKeyValues:dic];
        [mutableArray addObject:model];
    }
    return [mutableArray copy];
}
+(NSArray *)getPersonInfoData:(id)response {
    NSDictionary *infoDic = response[@"data"];
    NSLog(@"=====%@",infoDic);
    NSMutableArray *mutableArray = [NSMutableArray array];
    //字典转model的第三方MJExtension
    PersonModel *model = [PersonModel mj_objectWithKeyValues:infoDic];
    NSLog(@"---%@",model);
    [mutableArray addObject:model];
    return [mutableArray copy];
}
@end
